﻿using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;

namespace SomeKit.Serialization
{
    public static partial class SerializationHelper
    {
        public static void WriteObjectAsXml<T>(Stream s, T obj)
        {
            var serializer = new DataContractSerializer(typeof(T));
            serializer.WriteObject(s, obj);
        }

        public static void WriteObjectAsJson<T>(Stream s, T obj)
        {
            var serializer = new DataContractJsonSerializer(typeof(T));
            serializer.WriteObject(s, obj);
        }
    }
}
